﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example14.aspx.cs" Inherits="Chapter28.Example14" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 28-14 使用相同的元素</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <style>
        table {
            border: solid thin black;
            border-collapse: collapse;
            margin: 2px 0px;
            float: left;
        }

        td {
            padding: 4px 5px;
        }
    </style>
</head>
<body>
    <table border="1">
        <thead>
            <tr>
                <th>Fruit</th>
                <th>Color</th>
            </tr>
        </thead>
        <tbody>
            <tr class="plumrow">
                <td>Plum</td>
                <td>Purple</td>
            </tr>
        </tbody>
    </table>
    <table border="1">
        <thead>
            <tr>
                <th>Fruit</th>
                <th>Color</th>
            </tr>
        </thead>
        <tbody>
            <tr class="plumrow">
                <td>Plum</td>
                <td>Purple</td>
            </tr>
        </tbody>
    </table>
    <pre id="results"></pre>
    <script>
        var elems = document.getElementsByClassName("plumrow");

        if (elems[0].isEqualNode(elems[1])) {
            document.getElementById("results").innerHTML = "Elements are equal";
        } else {
            document.getElementById("results").innerHTML = "Elements NOT equal";
        }
    </script>
</body>
</html>
